﻿using Currency.Infra.Caching.Configurations;
using Currency.Infra.Caching.RedisProvider;
using Microsoft.Extensions.Logging;
using StackExchange.Redis;

namespace Currency.Infra.Caching.RedisExchange
{
    public partial class RedisCache : IRedisProvider
    {
        /// <summary>
        /// Redis数据库
        /// </summary>
        private readonly IDatabase _redisDb;

        /// <summary>
        /// 日志
        /// </summary>
        private readonly ILogger _logger;

        /// <summary>
        /// Reids配置
        /// </summary>
        private readonly ConnectionConfig _connectionConfig;

        public ConnectionConfig ConnectionConfig => _connectionConfig;

        //public override ConnectionConfig ConnectionConfig => _connectionConfig;

        public RedisCache(IRedisDatabase redisDatabase, ConnectionConfig connectionConfig, ILoggerFactory loggerFactory = null)
        {
            _redisDb = redisDatabase.GetDatabase();
            _connectionConfig = connectionConfig;
            _logger = loggerFactory?.CreateLogger<RedisCache>();
        }

    }
}
